package crs.logger.dao;
// Generated 23-dic-2014 12:05:32 by Hibernate Tools 4.3.1

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import crs.logger.model.CrsAccesolog;

/**
 * Home object for domain model class CrsAccesolog.
 * @see .CrsAccesolog
 * @author Hibernate Tools
 */
@Repository
public class CrsAccesologDaoImpl implements CrsAccesologDao{

	
	@Autowired
	private SessionFactory sf;
	
	private static final Log log = LogFactory.getLog(CrsAccesologDaoImpl.class);


	@Transactional
	public void persist(CrsAccesolog transientInstance) {
		log.debug("persisting CrsAccesolog instance");
		try {
			sf.getCurrentSession().persist(transientInstance);
			log.debug("persist successful");
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}


	public void remove(CrsAccesolog persistentInstance) {
		log.debug("removing CrsAccesolog instance");
		try {
			sf.getCurrentSession().delete(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public CrsAccesolog merge(CrsAccesolog detachedInstance) {
		log.debug("merging CrsAccesolog instance");
		try {
			CrsAccesolog result = (CrsAccesolog) sf.getCurrentSession().merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public CrsAccesolog findById(int id) {
		log.debug("getting CrsAccesolog instance with id: " + id);
		try {
			CrsAccesolog instance = (CrsAccesolog) sf.getCurrentSession().get(CrsAccesolog.class, id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
